class @AdminUserListingModel extends ListingModel
    @ListingUrl:''

    initialize: ->
        if AdminUserListingModel.ListingUrl.length==0
            AdminUserListingModel.ListingUrl = SiteMap.Admin.Users.Listing

    defaults:
        Users: []
        Size: 10
        Page: 1
        Direction: 0
        Column: "Email"
        Filter:
            Email: ''
            Login: ''

    url: ->
        url =  AdminUserListingModel.ListingUrl
        url = url + "?page=" + @attributes.Page
        url = url + "&size=" + @attributes.Size
        url = url + "&Column=" + @attributes.Column
        url = url + "&Direction=" + @attributes.Direction
        url = url + "&Filter.Email=" + @attributes.Filter.Email
        url = url + "&Filter.Login=" + @attributes.Filter.Login
        SiteMap.Admin.Users.Listing = encodeURI(url)
        return SiteMap.Admin.Users.Listing

    parse: (response) ->
        attrs = {
            Size: response.Size
            Page: response.Page
            TotalPages: response.TotalPages
            Column: response.Column
            Direction: response.Direction
            Filter: @attributes.Filter
        }

        attrs.Users = response.Users
        if response.Filter.Email?
            attrs.Filter.Email = response.Filter.Email
        if response.Filter.Login?
            attrs.Filter.Login = response.Filter.Login
        
        return attrs
